combobox—Always popup menu using current event
authorDaniel Boles <dboles@src.gnome.org>
Thu, 16 Feb 2017 21:33:25 +0000 (21:33 +0000)
committerDaniel Boles <dboles@src.gnome.org>
Thu, 16 Feb 2017 21:33:25 +0000 (21:33 +0000)
priv->trigger_event is never set, so it is always NULL. This means the
gtk_menu_popup*() methods use the current event. The only way to get any
other event to combobox_menu_popup() was from the button-press-event
handler I just removed, which would end up being the current one anyway.

So, bin priv->trigger_event & explicitly pass NULL to gtk_menu_popup*().

gtk/gtkcombobox.c

index 3bb5d8c4dd84491916294fa913c984bcebb69b28..e84520aa411d5ffa833445cfa04b10327c9486f6 100644 (file)
@@ -147,7 +147,6 @@ struct _GtkComboBoxPrivate
   gulong reordered_id;
   gulong changed_id;
   guint popup_idle_id;
-  GdkEvent *trigger_event;
   guint scroll_timer;
   guint resize_idle_id;
 
@@ -293,8 +292,7 @@ static void     gtk_combo_box_update_sensitivity   (GtkComboBox      *combo_box)
 static gboolean gtk_combo_box_menu_key_press       (GtkWidget        *widget,
                                                     GdkEventKey      *event,
                                                     gpointer          data);
-static void     gtk_combo_box_menu_popup           (GtkComboBox      *combo_box,
-                                                    const GdkEvent   *trigger_event);
+static void     gtk_combo_box_menu_popup           (GtkComboBox      *combo_box);
 
 /* cell layout */
 static GtkCellArea *gtk_combo_box_cell_layout_get_area       (GtkCellLayout    *cell_layout);
@@ -1475,8 +1473,7 @@ update_menu_sensitivity (GtkComboBox *combo_box,
 }
 
 static void
-gtk_combo_box_menu_popup (GtkComboBox    *combo_box,
-                          const GdkEvent *trigger_event)
+gtk_combo_box_menu_popup (GtkComboBox    *combo_box)
 {
   GtkComboBoxPrivate *priv = combo_box->priv;
   gint active_item;
@@ -1538,7 +1535,7 @@ gtk_combo_box_menu_popup (GtkComboBox    *combo_box,
                                 gtk_bin_get_child (GTK_BIN (combo_box)),
                                 GDK_GRAVITY_SOUTH_WEST,
                                 GDK_GRAVITY_NORTH_WEST,
-                                trigger_event);
+                                NULL);
     }
   else
     {
@@ -1594,7 +1591,7 @@ gtk_combo_box_menu_popup (GtkComboBox    *combo_box,
                                 GTK_WIDGET (combo_box),
                                 GDK_GRAVITY_WEST,
                                 GDK_GRAVITY_NORTH_WEST,
-                                trigger_event);
+                                NULL);
     }
 
     /* Re-get the active item before selecting it, as a popped-up handler – like
@@ -1660,15 +1657,13 @@ gtk_combo_box_popup_for_device (GtkComboBox *combo_box,
   if (gtk_widget_get_mapped (priv->popup_widget))
     return;
 
-  gtk_combo_box_menu_popup (combo_box, priv->trigger_event);
+  gtk_combo_box_menu_popup (combo_box);
 }
 
 static void
 gtk_combo_box_real_popup (GtkComboBox *combo_box)
 {
-  GtkComboBoxPrivate *priv = combo_box->priv;
-
-  gtk_combo_box_menu_popup (combo_box, priv->trigger_event);
+  gtk_combo_box_menu_popup (combo_box);
 }
 
 static gboolean
@@ -2766,8 +2761,6 @@ gtk_combo_box_destroy (GtkWidget *widget)
       priv->popup_idle_id = 0;
     }
 
-  g_clear_pointer (&priv->trigger_event, gdk_event_free);
-
   if (priv->box)
     {
       /* destroy things (unparent will kill the latest ref from us)